package www.woniuxy.com.class112.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import www.woniuxy.com.class112.util.Result;

@RestControllerAdvice
public class GlobalException {
    @ExceptionHandler
    public Result handlePermissionException(PermissionException e){
        return Result.noPermission();
    }
    @ExceptionHandler
    public Result handleNotLoginException(NotLoginException e){
        return Result.noLogin();
    }
    @ExceptionHandler
    public Result handleException(Exception e){
        e.printStackTrace();
        return Result.fail(e.getMessage(),null);
    }
}
